﻿using Domain.Entitys.Base_Manage;
using Domain.Entitys.DB;
using Domain.Entitys.FG;
using Domain.Entitys.Inv;
using Domain.Entitys.Pinv;
using Domain.Entitys.Sinv;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EFCore
{
    public class MyDbContext : DbContext
    {
        /// <summary>
        /// 配置链接字符串
        /// </summary>
        /// <param name="optionsBuilder"></param>
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            //链接字符串
            string connStr = "";
            optionsBuilder.UseSqlServer(connStr);
        }

        /// <summary>
        /// 读取配置类
        /// </summary>
        /// <param name="modelBuilder"></param>
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            //程序集
            modelBuilder.ApplyConfigurationsFromAssembly(this.GetType().Assembly);
        }

        // 系统管理相关
        public DbSet<Sys_User> Sys_User { get; set; }
        public DbSet<Sys_User_Role> Sys_User_Role { get; set; }
        public DbSet<Sys_Role> Sys_Role { get; set; }
        public DbSet<Sys_Menu> Sys_Menu { get; set; }
        public DbSet<Sys_Role_Menu> Sys_Role_Menu { get; set; }
        public DbSet<Sys_Dept> Sys_Dept { get; set; }
        public DbSet<Sys_Dict_Data> Sys_Dict_Data { get; set; }
        public DbSet<Sys_Dict_Type> Sys_Dict_Type { get; set; }

        // 基础数据相关
        public DbSet<Db_Product_Type> Db_Product_Type { get; set; }
        public DbSet<Db_Product> Db_Product { get; set; }
        public DbSet<Db_Attachment> Db_Attachment { get; set; }
        public DbSet<Db_Measure> db_Measure { get; set; }

        // 仓库相关
        public DbSet<Warehouse_zone> db_warehouse_zone { get; set; }
        public DbSet<Warehouse> db_warehouse { get; set; }
        public DbSet<Warehouse_location> db_warehouse_location { get; set; }

        // 库存相关
        public DbSet<inv_stock> inv_stock { get; set; } // 去重：仅保留一个定义
        public DbSet<Inv_othwr> inv_othwr { get; set; }
        public DbSet<Inv_othwrproddtl> inv_othwrproddtl { get; set; }
        public DbSet<Inv_othoutord> inv_othoutord { get; set; }
        public DbSet<Inv_othproddetails> inv_othproddetails { get; set; }
        public DbSet<Inv_trf> inv_trf { get; set; } // 新增自第二个版本
        public DbSet<Inv_trfproddtl> inv_trfproddtl { get; set; } // 新增自第二个版本
        public DbSet<Inv_qty> inv_qty { get; set; } // 新增自第二个版本
        public DbSet<inv_proddti> inv_proddti { get; set; } // 新增自第二个版本
        public DbSet<Inv_samp> inv_samp { get; set; } // 新增自第二个版本
        public DbSet<Inv_prodInfo> inv_prodInfo { get; set; } // 新增自第二个版本

        // 销售相关
        public DbSet<Sinv_Customer> Sinv_Customer { get; set; }
        public DbSet<Sinv_Sale_Order> Sinv_Sale_Order { get; set; }
        public DbSet<Sinv_Sale_Order_Details> Sinv_Sale_Order_Details { get; set; }
        public DbSet<Sinv_Sale_Outbound> Sinv_Sale_Outbound { get; set; }
        public DbSet<Sinv_Sale_Outbound_Details> Sinv_Sale_Outbound_Details { get; set; }
        public DbSet<Sinv_Sale_Return> Sinv_Sale_Return { get; set; }
        public DbSet<Sinv_Sale_Return_Details> Sinv_Sale_Return_Details { get; set; }

        // 采购相关
        public DbSet<pinv_vendor> pinv_Vendor { get; set; }
        public DbSet<Pinv_Po> Pinv_Po { get; set; }
        public DbSet<pinv_details> pinv_details { get; set; }
        public DbSet<Pinv_pb> pinv_Pb { get; set; }
        public DbSet<Pinv_purwhsedetail> Pinv_purwhsedetail { get; set; }
        public DbSet<Pinv_purret> Pinv_purret { get; set; }
        public DbSet<Pinv_podet> Pinv_podet { get; set; }

        // 成品相关
        public DbSet<FG_Picking_Outbound> FG_Picking_Outbound { get; set; } // 保留自第一个版本
        public DbSet<Fg_Picking_Outbound_Details> Fg_Picking_Outbound_Details { get; set; } // 保留自第一个版本
        public DbSet<FG_Finished_Goods_Store> FG_Finished_Goods_Store { get; set; } // 新增自第二个版本
        public DbSet<FG_Finished_Goods_Store_Details> FG_Finished_Goods_Store_Details { get; set; } // 新增自第二个版本
    }
}
